cmake_minimum_required(VERSION 3.18 FATAL_ERROR)

project(AppSdk)
set(CMAKE_FOLDER "SDK Library")

# version info
set(SDK_VERSION_MAJOR 0)
set(SDK_VERSION_MINOR 0)
set(SDK_VERSION_REVISION 0)

file(GLOB_RECURSE PUB_HEADERS include/*)
file(GLOB_RECURSE PRI_SOURCES source/*)

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include PREFIX "Public Headers" FILES ${PUB_HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/source PREFIX "Sources" FILES ${PRI_SOURCES})

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/version.h)

add_library(pi_sdk SHARED ${PUB_HEADERS} ${PRI_SOURCES})
target_compile_definitions(pi_sdk PUBLIC -DRTTR_DLL)
target_compile_definitions(pi_sdk PRIVATE -DCORE_SDK_BUILD -DRTTR_DLL_EXPORTS)
target_include_directories(pi_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source)
target_include_directories(pi_sdk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(pi_sdk PUBLIC fmt)
target_link_libraries(pi_sdk PRIVATE PkgConfig::Zstd)
target_precompile_headers(pi_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/metadata/detail/base/pch.h)
target_strip(pi_sdk)
